CPU 686
BITS 32

%include 'rtc.inc'

global _get_time

extern _read_rtcv
extern _write_rtcv
extern _bcd2dec

section .text

_get_time:
	push ebp
	mov ebp, esp
	push ebx
	
	; LE HORAS
	push RTC_HOUR
	call _read_rtcv
	add esp, 4
	push eax
	call _bcd2dec
	add esp, 4
	
	mov ebx, arg1
	mov [ebx], eax
	
	;LE MINUTOS
	push RTC_MIN
	call _read_rtcv
	add esp, 4
	push eax
	call _bcd2dec
	add esp, 4
	
	mov ebx, arg2
	mov [ebx], eax
	
	;LE SEGUNDOS
	push RTC_SEC
	call _read_rtcv
	add esp, 4
	push eax
	call _bcd2dec
	add esp, 4
	
	mov ebx, arg3
	mov [ebx], eax
	
	pop ebx
	mov esp, ebp
	pop ebp
	ret
END
	
	